package com.lemon.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "bilibili", url = "https://api.bilibili.com")
public interface BilibiliFeign {

    /**
     *
     * @param agent Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
     * @param cookie i-wanna-go-back=-1; buvid_fp_plain=undefined; DedeUserID=162981410; DedeUserID__ckMd5=72575eb890793f39; CURRENT_BLACKGAP=0; blackside_state=0; hit-dyn-v2=1; CURRENT_FNVAL=4048; rpdid=|(RlRkl|uJ~0J'uYY)~J~YRR; fingerprint=36843d81fd26cf011a8f8163cd8208b5; SESSDATA=6d20e063%2C1690793138%2Caec20%2A21; bili_jct=d812090bd42cdd6985a24c9fc52235f9; buvid4=4064EEC4-C080-27D2-CC5B-C7A9C0926EB667626-022021411-%2BZCMR%2B2k%2F7A1yLPRmWQHlw%3D%3D; LIVE_BUVID=AUTO8816762793753374; buvid3=17C4FCD2-EA50-BDCC-766A-E90232F27A3820097infoc; b_nut=1676518420; _uuid=AA1710AB9-F1010D-DE5C-C9E4-DBAF8E126D1B20144infoc; hit-new-style-dyn=0; b_ut=5; header_theme_version=CLOSE; PVID=1; CURRENT_QUALITY=64; bsource=search_google; buvid_fp=36843d81fd26cf011a8f8163cd8208b5; bp_video_offset_162981410=777810554540523500; sid=78e5d3kr; nostalgia_conf=-1; home_feed_column=4; innersign=1; CURRENT_PID=7f96a1f0-ceee-11ed-99aa-d1e74d5467ad; b_lsid=B6823D7A_1873531AECA
     * @param type video
     * @param keyword 关键字
     * @param order click
     * @param page 1
     * @return
     */
    @GetMapping("/x/web-interface/search/type")
    String search(@RequestHeader("User-Agent") String agent,
                  @RequestHeader("cookie") String cookie,
                  @RequestParam("search_type") String type,
                  @RequestParam("keyword") String keyword,
                  @RequestParam("order") String order,
                  @RequestParam("page") String page);

    /**
     *
     * @param agent
     * @param cookie
     * @param uid uid
     * @param page 页数
     * @return
     */
    @GetMapping("/x/space/wbi/arc/search")
    String searchByUid(@RequestHeader("User-Agent") String agent,
                  @RequestHeader("cookie") String cookie,
                  @RequestParam("mid") String uid,
                  @RequestParam("pn") int page);


    /**
     * 总览 这些数据里面包含cid 需要解析
     *
     * @param agent
     * @param cookie
     * @param bvid
     * @return
     */
    @GetMapping("/x/web-interface/view")
    String view(@RequestHeader("User-Agent") String agent,
                  @RequestHeader("cookie") String cookie,
                  @RequestParam("bvid") String bvid);

    /**
     * 返回的数据中包含视频地址 需要解析处理
     * @param agent
     * @param cookie
     * @param fnval 1
     * @param qn 80
     * @param bvid
     * @param cid
     * @return
     */
    @GetMapping("/x/player/playurl")
    String videoUrl(@RequestHeader("User-Agent") String agent,
                       @RequestHeader("cookie") String cookie,
                       @RequestParam("fnval") String fnval,
                       @RequestParam("qn") String qn,
                       @RequestParam("bvid") String bvid,
                       @RequestParam("cid") String cid);


    @GetMapping("/x/web-interface/nav")
    String nav();

}
